<!-- 轮播图公共组件 -->
<template>
  <div class="main-banner">
    <el-carousel height="450px" indicator-position="outside" arrow="always" class="custom-carousel">
      <el-carousel-item v-for="(item, index) in banners" :key="index">
        <div class="main-banner-slide" :style="{backgroundImage: `url(${item.bgImage})`}">
          <div class="banner-content">
            <h1>{{ item.title }}</h1>
            <p>{{ item.desc }}</p>
            <el-button type="primary" size="large" class="banner-btn">{{ item.buttonText }}</el-button>
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  name: 'MainBanner',
  props: {
    banners: {
      type: Array,
      required: true,
      default: () => ([
        {
          title: '探索知识的海洋',
          desc: '来自全国顶尖高校的优质课程',
          buttonText: '立即体验',
          bgImage: 'https://edu-image.nosdn.127.net/C7F81100F90F8DB85704C901C4CFFC9D.jpg'
        },
        {
          title: '突破自我，提升实力',
          desc: '专业认证课程，提升就业竞争力',
          buttonText: '了解更多',
          bgImage: 'https://edu-image.nosdn.127.net/249dc9d7-fbd5-41fb-8e1d-a92c79be05c8.jpg'
        },
        {
          title: '名师指导，助力成长',
          desc: '知名教授在线授课，答疑解惑',
          buttonText: '现在开始',
          bgImage: 'https://edu-image.nosdn.127.net/30F964990D6937557C05DD9EDD6C5BA3.jpg'
        }
      ])
    }
  }
}
</script>

<style scoped>
/* 轮播图区域样式 */
.main-banner {
  width: 100%;
  margin-bottom: 40px;
}

.custom-carousel {
  width: 100%;
}

.main-banner-slide {
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  padding: 0 10%;
  position: relative;
}

.main-banner-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0) 100%);
}

.banner-content {
  position: relative;
  z-index: 1;
  color: #fff;
  max-width: 600px;
}

.banner-content h1 {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 20px;
  line-height: 1.2;
}

.banner-content p {
  font-size: 20px;
  margin-bottom: 30px;
  line-height: 1.5;
  opacity: 0.9;
}

.banner-btn {
  padding: 12px 30px;
  font-size: 18px;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.banner-btn:hover {
  transform: translateY(-2px);
}

/* 自定义轮播图指示器样式 */
:deep(.el-carousel__indicators) {
  bottom: 20px;
}

:deep(.el-carousel__indicator) {
  padding: 12px 4px;
}

:deep(.el-carousel__button) {
  width: 30px;
  height: 3px;
  border-radius: 2px;
  background-color: rgba(128, 128, 128, 0.4);
  transition: all 0.3s ease;
}

:deep(.el-carousel__indicator.is-active .el-carousel__button) {
  background-color: rgba(128, 128, 128, 0.8);
}

/* 自定义轮播图箭头样式 */
:deep(.el-carousel__arrow) {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  transition: all 0.3s ease;
}

:deep(.el-carousel__arrow:hover) {
  background-color: rgba(0, 0, 0, 0.5);
}

:deep(.el-carousel__arrow i) {
  font-size: 20px;
}

/* 响应式样式 */
@media (max-width: 768px) {
  .banner-content {
    padding: 0 40px;
  }
  
  .banner-content h1 {
    font-size: 28px;
  }
  
  .banner-content p {
    font-size: 16px;
  }
}
</style> 